let app = getApp()
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    show:{
      type:Boolean,
      value:false
    },
    type:{
      type:Number,
      value:1
    },
    qun:{//进群数值1估分2会员3调剂4首页5口语
      type:Number,
      value:1
    },
    gou:{//1兑换调剂会员2兑换口语会员
      type:Number,
      value:1
    }
  },
attached(){
  console.log(wx.$cache.get('jinqun'),'da',wx.$cache.get('key'))
 this.setData({
   jinqun: wx.$cache.get('jinqun'),
   jinqun2: wx.$cache.get('can').activation_str,
   jinqun3:wx.$cache.get('can').activation_group_str,
   jinqun4:wx.$cache.get('can').ky_vip_str
 })
},
  /**
   * 组件的初始数据
   */
  data: {
    jinqun:'',//进群数字
    domain:app.domain,
    code:'',
    jinqun2:'',//调剂进群
    jinqun4:'',//进口语群
  },

  /**
   * 组件的方法列表
   */
  methods: {
    close(){
      this.setData({
        show:false
      })
    },
    forme(){//首次加载没出来
      this.setData({
        jinqun: wx.$cache.get('jinqun'),
        jinqun2: wx.$cache.get('can').activation_str,
        jinqun3:wx.$cache.get('can').activation_group_str,
        jinqun4:wx.$cache.get('can').ky_vip_str
      })
    },
    bindcode(e){
      this.setData({
        code:e.detail.value
      })
    },
    huoqu(){//跳转公众号
      app.globalData.content = 'http://mp.weixin.qq.com/s?__biz=Mzg2OTE3ODY3NQ==&mid=100016700&idx=1&sn=4c7908ca807fae317831c56054db5aa4&chksm=4ea38e6079d40776891329893322fabee6fb79b70591e42efc7185101224e6ed100ea28c1906#rd';
      wx.navigateTo({
        url: '/pages/waparse/waparse?title=如何获取激活码' + '&is_url=' + 2,
      })
    },
    suree2(){//
      if(this.data.code===''){
        wx.showToast({
          title: '请输入激活码',
          icon: 'none',
          duration: 2000
        })
        return
      }
      var pageArr = getCurrentPages();
      var thisPage = pageArr[pageArr.length - 1];
      thisPage.jinqu()
    },
    suree(){
      if(this.data.code.length!=21){
        wx.showToast({
          title: '激活码错误',
          icon: 'none',
          duration: 2000
        })
        return
      }
      if(this.data.code.substring(0,3)!='vip'){
        wx.showToast({
          title: '激活码错误',
          icon: 'none',
          duration: 2000
        })
        return
      }
      wx.$cache.set('fen',true)
      this.setData({
        show:false
      })
      if(wx.$cache.get('fen')){
        var pageArr = getCurrentPages();
      var thisPage = pageArr[pageArr.length - 1];
      thisPage.jinqu()
      }
    }
  }
})
